<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	圆的半径:<input type="text" id="input1"/>
	<button onclick="calc()">计算</button>
	<script>
		
		console.log("π="+Math.PI);
		function calc()
		{
			var r = parseFloat(input1.value)
			var area =Math.PI*r*r;
			alert("圆的面积："+area);
		}
		function calc()
		{
			var r = parseFloat(input1.value)
			var zhou =Math.PI*r*2;
			alert("圆的周长："+zhou);
		}
		
		//Math.abs求绝对值
		console.log(Math.abs(-10));
		//Math.round四舍五入
		console.log(Math.round(4.4));
		console.log(Math.round(4.5));
		//Math.ceil() 天花板 往上取整
		//Math.floor() 地板 往下取整
		console.log(Math.ceil(4.5));
		console.log(Math.floor(4.5));
		//Math.pow()
		console.log(Math.pow(2,10));
		//Math.sqrt()
		console.log(Math.sqrt(16));
		//Math.random()
		console.log(Math.random())
		console.log(Math.floor(Math.random()*10+1));
		console.log(Math.floor(Math.random()*3+1));

	
	</script>
	</body>
</html>
